home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / os2 / cpostsrc.arj / HASH.H < prev    next >
Text File  |  1992-08-08  |  2KB  |  74 lines

  1. /*------------------------------------------------------------------
  2.  * hash.h : hash table functions
  3.  *------------------------------------------------------------------
  4.  * 10-19-88 originally by Patrick J. Mueller
  5.  * 08-07-92 fixed up by Patrick J. Mueller
  6.  *------------------------------------------------------------------*/
  7.  
  8. #if !defined(HASH_H_INCLUDED)
  9. #define HASH_H_INCLUDED
  10.  
  11. typedef int HashFunc     (void *pItem, int buckets);
  12.  
  13. typedef struct
  14.    {
  15.    int                itemSize;
  16.    int                buckets;
  17.    List             **bucket;
  18.    HashFunc          *hashFunc;
  19.    ListNoMemFunc     *memFunc;
  20.    } Hash;
  21.  
  22. /*------------------------------------------------------------------
  23.  * create a hash table
  24.  *------------------------------------------------------------------*/
  25. Hash *HashCreate(
  26.    int                  itemSize,
  27.    int                  buckets,
  28.    HashFunc            *hashFunc,
  29.    ListCompareFunc     *cmpFunc,
  30.    ListNoMemFunc       *memFunc
  31.    );
  32.  
  33. /*------------------------------------------------------------------
  34.  * destroy a hash table
  35.  *------------------------------------------------------------------*/
  36. void HashDestroy(
  37.    Hash *hash
  38.    );
  39.  
  40. /*------------------------------------------------------------------
  41.  * find an entry in a hash table
  42.  *------------------------------------------------------------------*/
  43. void *HashFind(
  44.    Hash  *hash,
  45.    void  *pItem
  46.    );
  47.  
  48. /*------------------------------------------------------------------
  49.  * add an entry to a hash table
  50.  *------------------------------------------------------------------*/
  51. void *HashAdd(
  52.    Hash *hash,
  53.    void *pItem
  54.    );
  55.  
  56. /*------------------------------------------------------------------
  57.  * delete an entry from a hash table
  58.  *------------------------------------------------------------------*/
  59. void HashDelete(
  60.    Hash *hash,
  61.    void *pTtem
  62.    );
  63.  
  64. /*------------------------------------------------------------------
  65.  * iterate through hash table
  66.  *------------------------------------------------------------------*/
  67. void HashIterate(
  68.    Hash            *hash,
  69.    ListIterateFunc *pIterateFunc,
  70.    void            *pUserData
  71.    );
  72.  
  73. #endif
  74.